﻿using ViewMaker.Core.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using ViewMaker.Core;
using System.Collections.Generic;
using System.Xml;
using System.Windows.Markup;
using System.Windows.Controls;

namespace ViewMaker.Core.Tests
{
    [TestClass()]
    public class ButtonViewControlTest
    {

        [TestMethod()]
        public void 標準的なButtonのXAML生成()
        {
            var target = new ButtonViewControl { Width = 100, Item = new ViewLayoutItem { Name = "btn001", Caption = "ボタン", BindPath = "command" } };
            var xaml = target.CreateXaml(TestHelper.CreateTestParent())[0];
            var actual = TestHelper.GetFrameworkElement<Button>(xaml);
            Assert.AreEqual("btn001", actual.Name);
            Assert.AreEqual("ボタン", actual.Content);
            Assert.AreEqual("command", actual.GetBindingExpression(Button.CommandProperty).ParentBinding.Path.Path);
        }

        [TestMethod()]
        public void ButtonViewControlの編集画面が表示可能()
        {
            var target = new ButtonViewControl { Width = 100, Item = new ViewLayoutItem { Name = "btn001", Caption = "ボタン", BindPath = "command" } };
            var baml = ViewUtil.BuildContent(target);
            Assert.IsNotNull(baml);
        }

    }
}
